package com.cookie.meetproject.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.cookie.framework.helper.GlideHelper;
import com.cookie.meetproject.R;
import com.cookie.meetproject.model.StarModel;
import com.moxun.tagcloudlib.view.TagsAdapter;

import java.util.List;

/**
 * 项目名:    MeetProject
 * 包名:      com.cookie.framework.adapter
 * 文件名:    CloudTagAdapter
 * 创建者:    cookie
 * 创建时间:   2020/1/6 0:22
 * 描述:      3D星球适配器
 */

public class CloudTagAdapter extends TagsAdapter {

    private Context context;
    private List<StarModel> list;
    private LayoutInflater inflater;

    public CloudTagAdapter(Context context, List<StarModel> list) {
        this.context = context;
        this.list = list;
        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public View getView(Context context, int position, ViewGroup parent) {
        View view = inflater.inflate(R.layout.layout_star_view_item, null);
        ImageView ivStarIcon = view.findViewById(R.id.iv_star_icon);
        TextView tvStarName = view.findViewById(R.id.tv_star_name);
        GlideHelper.loadUrl(context,list.get(position).getPhotoUrl(),ivStarIcon);
        tvStarName.setText(list.get(position).getNickName());
        return view;
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getPopularity(int position) {
        return 7;
    }

    @Override
    public void onThemeColorChanged(View view, int themeColor) {

    }
}
